
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Redis的7中类型结构 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Redis的7中类型结构 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Redis的String类型最大可以存储多大的数据？它有哪些典型的应用场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">String类型的值最大可以存储512MB的数据。其典型应用场景包括：缓存、计数器、会话管理、分布式锁和简单的消息队列（通过LPUSH和RPUSH命令）。</div>
          </div>
          <div class="card-source">来源: String(字符串)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Redis的Hash类型适合存储什么样的数据结构？其内部结构与Java中的哪种集合类似？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Hash类型适合存储对象的字段和值，例如用户信息、产品信息等。其内部结构类似于Java中的HashMap。</div>
          </div>
          <div class="card-source">来源: Hash(哈希)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">如何利用Redis的List类型分别实现一个先进先出（FIFO）的队列和一个后进先出（LIFO）的栈？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">实现FIFO队列可以通过LPUSH和RPOP操作；实现LIFO栈可以通过LPUSH和LPOP操作。</div>
          </div>
          <div class="card-source">来源: List（列表）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Redis的Set类型具有哪些核心特点？其高效操作（添加、删除、查找）的底层原因是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Set类型是一个无序的字符串集合，其核心特点是不允许重复的成员。它之所以高效，是因为Redis内部使用哈希表实现Set类型，确保了添加、删除、查找操作的平均时间复杂度为O(1)。</div>
          </div>
          <div class="card-source">来源: Set（集合）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">比较</div>
          <div class="card-question">Sorted Set（有序集合）与普通Set相比有何关键区别？它是如何实现元素排序的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">比较</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">关键区别在于Sorted Set中的每个成员都与一个称为“分数”（score）的浮点数值相关联。成员是唯一的，但分数可以重复。它是通过成员关联的分数大小进行排序的。</div>
          </div>
          <div class="card-source">来源: Sorted Set(有序集合)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">Sorted Set（有序集合）因其排序特性，常被用于哪些具体的应用场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Sorted Set的常见应用场景包括：排行榜（存储分数和排名）、带权重的任务调度（按优先级处理任务）、时间轴（按时间顺序检索数据）以及数据统计。</div>
          </div>
          <div class="card-source">来源: Sorted Set(有序集合)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Redis的Bitmap类型在底层是如何存储的？它适合处理哪些应用场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Bitmap在Redis中以字符串类型（String）的形式存储，每个位存储一个二进制值（0或1）。它适合的应用场景包括布尔型状态存储（如用户在线状态）、快速计数和大规模数据去重。</div>
          </div>
          <div class="card-source">来源: Bitmap类型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">什么是Redis的HyperLogLog（HLL）？它为了实现高效和节省内存的目标，做出了怎样的权衡？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">HyperLogLog（HLL）是一种基数估计算法，用于统计数据集合中的唯一元素数量。它通过牺牲一定的准确性来换取更小的内存消耗，适合处理大规模数据集合时的基数估计。</div>
          </div>
          <div class="card-source">来源: HyperLogLog类型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">HyperLogLog的内部实现依赖于什么核心思想和数据结构？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">HyperLogLog的核心思想是利用随机化和位运算来统计近似数量。它内部使用一组称为“程序计数器”（registers）的稀疏数据结构来记录观察到的元素哈希值的最大前导零位数，从而估计基数。</div>
          </div>
          <div class="card-source">来源: HyperLogLog类型</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
